package com.example.javalib;

import java.util.*;

public class asd {

    public static void look(String name,TreeSet<Integer> ts,HashMap<Integer,String> hms){
        System.out.println(name+"牌是：");
        for (Integer k : ts){
            String pok =hms.get(k);
            System.out.print(pok+" ");
        }
        System.out.println();
    }




    public static void main(String[] args) {
        HashMap<Integer,String> hm = new HashMap<>();
        ArrayList<Integer> arr = new ArrayList<>();

        String[] cal = {"A","B","C","D"};
        String[] inti = {"3","4","5","6","7","8","9","10","11","12","13","14","14"};

        int ins=0;

        for (String intis : inti){
            for (String cals : cal){
                hm.put(ins,cals+intis);
                arr.add(ins);
                ins++;
            }
        }
        hm.put(ins,"小");
        ins++;
        hm.put(ins,"大");
        arr.add(ins);


        Collections.shuffle(arr);

        TreeSet<Integer> ts1 = new TreeSet<>();
        TreeSet<Integer> ts2 = new TreeSet<>();
        TreeSet<Integer> ts3 = new TreeSet<>();
        TreeSet<Integer> ts4 = new TreeSet<>();

        for (int i=0;i<arr.size();i++){
            int x =arr.get(i);
            if (i>=arr.size()-3){
                ts4.add(arr.get(i));
            }else if(i%3==0){
                ts1.add(x);
            }else if(i%3==1){
                ts2.add(x);
            }else if(i%3==2){
                ts3.add(x);
            }
        }

        look("一号",ts1,hm);
        look("二号",ts2,hm);
        look("三号",ts3,hm);
        look("剩下的牌是",ts4,hm);

    }
}
